/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wicketsystem;

/**
 *
 * @author Daryna_Ragimova
 */
public class AccumulativeCard extends TypicalCard {

    public double priceOfTrip;
    public double money;

    public AccumulativeCard(int id, double priceOfTrip, double money) {
        super(id, Types.USUAL);
        this.priceOfTrip = priceOfTrip;
        this.money = money;
    }

    public double addMoney(double sum) {
        return money += sum;
    }

    public double decreaseMoney() {
        money -= priceOfTrip;
        return money;
    }

    @Override
    public boolean check() {
        if (money < priceOfTrip) {
            return false;
        }
        return true;
    }

    @Override
    public boolean getTrip() {
        if (check()) {
            decreaseMoney();
            return true;
        }
        return false;
    }
}
